package offer;

public class Offer65 {

    public int add(int a, int b) {
        while (b != 0) { // 当进位为 0 时跳出
            int c = (a & b) << 1;  // c = 进位
            a ^= b; // a = 非进位和
            b = c; // b = 进位
        }
        return a;

    }

    public static void main(String[] args) {
        Offer65 offer65 = new Offer65();
        System.out.println(offer65.add(1, 1));
    }

}
